package com.swinw.micimerci.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.swinw.micimerci.entity.MemberCollectEntity;
import com.swinw.micimerci.service.MemberCollectService;
import com.swinw.micimerci.utils.PageUtils;
import com.swinw.micimerci.utils.R;



/**
 * 
 *
 * @author swinw
 * @email 2407550328@qq.com
 * @date 2020-11-03 19:32:49
 */
@RestController
@RequestMapping("micimerci/membercollect")
public class MemberCollectController {
    @Autowired
    private MemberCollectService memberCollectService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("micimerci:membercollect:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = memberCollectService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("micimerci:membercollect:info")
    public R info(@PathVariable("id") Integer id){
		MemberCollectEntity memberCollect = memberCollectService.getById(id);

        return R.ok().put("memberCollect", memberCollect);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("micimerci:membercollect:save")
    public R save(@RequestBody MemberCollectEntity memberCollect){
		memberCollectService.save(memberCollect);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("micimerci:membercollect:update")
    public R update(@RequestBody MemberCollectEntity memberCollect){
		memberCollectService.updateById(memberCollect);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("micimerci:membercollect:delete")
    public R delete(@RequestBody Integer[] ids){
		memberCollectService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
